﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using NTTDATA.BEENChina.ResultCertification.Config;

namespace NTTDATA.BEENChina.ResultCertification.Checker.Date
{

    [Serializable]
    [VerfityAttribute(Id = "VerfityRq0205", Name = "文字列检查", CategoryType = EnumCategoryType.日期, Model = true)]
    public class VerfityRq0205 : VerfityOneResult
    {
        /// <summary>
        /// 
        /// </summary>
        private bool _empty = true;

        /// <summary>
        ///         
        /// </summary>
       [Category("有/无记载"), Description("（false:有记载,true:无记载）")]
        public bool Empty
        {
            get { return _empty; }
            set { _empty = value; }
        }

       public override bool CheckResult(List<List<string>> result, string entryCommon)
        {
            bool bresult = false;

            foreach (var rowResult in result)
            {
                //for debug
                foreach (var entryResult in rowResult)
                {
                    //结果全是 sting.empty 
                    //ex  "////" 不算
                    if (String.IsNullOrEmpty(entryResult.Replace("/", string.Empty)))
                    {
                        continue;
                    }

                    //找到录入结果中的 文字
                    var ss = new Split.SplitEntryResult(ChildImageObject.CategorySetting.DataFormat, entryResult).GetText();

                  

                    if (Empty)
                        bresult = string.IsNullOrEmpty(ss);
                    else
                        bresult = !string.IsNullOrEmpty(ss);

                    if (bresult)
                    {
                        //System.Console.WriteLine(ss);
                        break;
                    }
                }

                if (bresult)
                    break;
                
            }

            if (bresult)
            {
                System.Console.WriteLine("VerfityRq0205");
            }

            return bresult;
        }

    }
}
